<?php
error_reporting(E_ERROR|E_WARNING|E_PARSE|E_USER_ERROR|E_USER_WARNING);//6143
header('Content-Type: text/html; charset=utf-8');
if(@function_exists('date_default_timezone_set'))
	@date_default_timezone_set('Asia/Shanghai'); 
	
$config['model']=1;//1 mall 2 shop
$config['version']='v1.0';
$config['webroot']=substr(dirname(__FILE__), 0, -9);
ini_set('include_path',$config['webroot'].'/');

include_once($config['webroot']."/config/config.inc.php");
include_once($config['webroot']."/config/web_config.php"); 
include_once($config['webroot']."/config/table_config.php");
include_once($config['webroot']."/includes/convertip.php");
include_once($config['webroot']."/includes/function.php");
include_once($config['webroot']."/config/uc_config.php");
include_once($config['webroot']."/includes/db_class.php"); 
define("WEBROOT", $config['webroot']);
define("LANG", $config['language']);
define("DATAFORMAT", $config['date_format']);
/*------------------ 定义运行环境 -------------------------*/
$runEnv = 'dev';
$hostName = gethostname();
if($hostName == 'web-01')
{
	$runEnv = 'produce';
}else if($hostName == 'test'){
    $runEnv = 'test';
}
define('RUN_ENV',$runEnv);
/*------------------ ----------------------------*/
$db=new dba($config['dbhost'],$config['dbuser'],$config['dbpass'],$config['dbname'],$config['dbport']);
if(is_mobile())
{
	if(!empty($_GET["temp"]))
	{
		if(!empty($_GET["temp"]))
		{
			setcookie("temp",$_GET["temp"]);
			msg($config['weburl']);
		}	
	}
	if(!empty($_COOKIE['temp']))
	{
		$config['temp']=$_COOKIE['temp'];
	}
	else
	{
		$config['temp']="wap";	
	}
}
else
{
	if(!empty($_GET["temp"]))
	{
		setcookie("temp",$_GET["temp"]);
		msg($config['weburl']);
	}
	if(!empty($_COOKIE['temp']))
		$config['temp']=$_COOKIE['temp'];
}

magic();//魔术调用
?>